package com.example.bili.controller;

import com.example.bili.entity.Comments;
import com.example.bili.service.CommentsService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpSession;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/comments")
public class CommentsController {
    @Resource
    private CommentsService commentsService;
    //添加
    @GetMapping("/add")
    public Object add(/*HttpSession session,*/
            @RequestParam  String content,
            @RequestParam Integer userId){
        /*User user = (User) session.getAttribute(CommonUtil.LOG_USER_KEY);*/

        return commentsService.add(userId,content);
    }
    //查询所有

    @GetMapping("/all")
    public Object getall(){
        return commentsService.getall();
    }


}
